﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Website
{
    public partial class ucViewProduct : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                System.Data.DataTable dt = new System.Data.DataTable();
                int ProductID = int.Parse(Request.QueryString["ProductID"].ToString());
                dt = new BUS.ProductsBUS().GetProductByID(ProductID);
                ImageProduct.ImageUrl = "images/Products/" + dt.Rows[0]["Image"].ToString();
                LabelProductName.Text = dt.Rows[0]["ProductName"].ToString();
                LabelQuantityPerUnit.Text = dt.Rows[0]["QuantityPerUnit"].ToString();
                LabelUnitPrice.Text = dt.Rows[0]["UnitPrice"].ToString();
                LabelDiscount.Text = dt.Rows[0]["Discount"].ToString();
                LabelDiscription.Text = dt.Rows[0]["Description"].ToString();
                LabelCategory.Text = dt.Rows[0]["CategoryID"].ToString();
                HiddenFieldProductID.Value = dt.Rows[0]["ProductID"].ToString();
            }
            catch (Exception ex)
            {
                Response.Write("San pham ko ton tai " + ex.ToString());
            }
        }
    }
}